//
//  PaySuccessViewController.m
//  EasyToTesco
//
//  Created by 杨森 on 16/4/6.
//  Copyright © 2016年 Jack. All rights reserved.
//

#import "PaySuccessViewController.h"
#import "HomeViewController.h"

#define WEITH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height

@interface PaySuccessViewController ()


@end

@implementation PaySuccessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor colorWithRed:234/255.0 green:234/255.0 blue:234/255.0 alpha:1];
    [self addCreditTopUI];
    [self addSubView];
}

- (void)addCreditTopUI {
    
    UIButton *goBackBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    goBackBtn.frame = CGRectMake(WEITH-50, 0, self.secondView.frame.size.height, self.secondView.frame.size.height);
    
    [goBackBtn setTitle:@"完成" forState:UIControlStateNormal];
    goBackBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    [goBackBtn setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
    
    [goBackBtn addTarget:self action:@selector(gobackClick) forControlEvents:UIControlEventTouchUpInside];
    [self.secondView addSubview:goBackBtn];
    
    self.titleLabel.text = @"支付成功";
}

- (void)gobackClick {
    [self dismissViewControllerAnimated:YES completion:nil];
    
}
- (void)addSubView
{
    UIView *payView = [[UIView alloc] initWithFrame:CGRectMake(0,CGRectGetMaxY(self.secondView.frame)+20, WEITH,HEIGHT/3)];
    payView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:payView];
    UIImage *image = [UIImage imageNamed:@"图标"];
    UIImageView *payImage = [[UIImageView alloc] initWithImage:image];
    payImage.center = CGPointMake(payView.center.x, payView.center.y-100);
    payImage.bounds = CGRectMake(0, 0,60,60);
    payImage.layer.cornerRadius = payImage.frame.size.width/2;
    payImage.clipsToBounds = YES;
    
    
    UILabel *label = [[UILabel alloc] init];
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor colorWithRed:52/255. green:147/255. blue:225/255. alpha:1];
    label.font = [UIFont systemFontOfSize:13];
    label.text = @"您已支付成功";
    label.center = CGPointMake(payView.center.x, CGRectGetMaxY(payImage.frame)+ 20);
    label.bounds = CGRectMake(0, 0, 100, 44);
    
    
    UILabel *secondLabel = [[UILabel alloc] init];
    secondLabel.textAlignment = NSTextAlignmentCenter;
    secondLabel.textColor = [UIColor lightGrayColor];
    secondLabel.font = [UIFont systemFontOfSize:12];
    secondLabel.text = @"预计十分钟到账,充值成功后将会收到通知该商品由亿乐购物吧提供";
    secondLabel.numberOfLines = 2;
    secondLabel.center = CGPointMake(payView.center.x, CGRectGetMaxY(label.frame)+10);
    secondLabel.bounds = CGRectMake(0, 0, 220, 44);
  
    
    [payView addSubview:payImage];
    [payView addSubview:label];
    [payView addSubview:secondLabel];
    
}


@end
